package com.sxpi.lock;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: 董伟豪
 * @Date: 2022/11/6 17:53
 */
@Slf4j
public class LockOne {

    // 主线程 main-thread
    public static void main(String[] args) {
        // 线程类1 --- 存钱
        Thread thread1 = new Thread(new LockThread(100));//this---new LockThread(100)
        thread1.setName("存钱-Thread");
        // 启动线程 -- 存钱
        thread1.start();

        // 线程类2----取钱
        Thread thread2 = new Thread(new LockThread(-100));//this---new LockThread(-100)
        thread2.setName("取钱-Thread");
        // 启动线程---取钱
        thread2.start();

    }
}
